package com.baizhi.controller;


import com.baizhi.entity.Menu;
import com.baizhi.service.IMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 菜单管理 前端控制器
 * </p>
 *
 * @author haiyu
 * @since 2021-09-06
 */
@RestController
@RequestMapping("/menu")
public class MenuController {

    @Autowired
    private IMenuService im;
    @GetMapping("selectMenu")//该方法用于循环展示列名
    @PreAuthorize("hasAuthority('sys:user:list,sys:user:info')")
   public List<Menu> selectUserMenu(){
        List<Menu> menus = im.selectUserMenu();
        return menus;
    }

    @GetMapping("/sjd")
    @PreAuthorize("hasAuthority('sys:schedule:list,sys:schedule:info')")
    public List<Menu> selectMenuTree(){
        List<Menu> menus = im.selectMenuTree();
        return  menus;
    }

}

